package com.gitee.chenyaohua.oa.from.vo;


import com.fasterxml.jackson.annotation.JsonProperty;
import com.gitee.chenyaohua.oa.from.dto.VerificationType;
import com.gitee.chenyaohua.oa.from.validator.CheckVerificationCode;
import com.gitee.chenyaohua.oa.from.validator.GetVerificationCode;
import lombok.Data;

import javax.validation.constraints.*;

@Data
public class VerificationFrom {

    /**
     * 邮箱
     */
    @JsonProperty("email")
    @NotBlank(groups = {CheckVerificationCode.class, GetVerificationCode.class},message = "邮箱不能是空")
    @Size(groups = {CheckVerificationCode.class, GetVerificationCode.class},message = "邮箱必须小于40个字符",max = 40)
    @Email(groups = {CheckVerificationCode.class, GetVerificationCode.class},message = "邮箱不符合规则")
    private String email;

    /**
     * 验证码
     */
    @JsonProperty("code")
    @NotBlank(groups = CheckVerificationCode.class,message = "验证码不能是空")
    @Pattern(regexp = "[0-9]{6}",groups = CheckVerificationCode.class,message = "验证码必须是6位数字")
    private String code;


    /**
     * 验证码类型
     */
    @JsonProperty("type")
    @NotNull(groups = {CheckVerificationCode.class,CheckVerificationCode.class},message = "验证码类型不能是空")
    private VerificationType type;


}
